<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

</body>
<script>
function setToken(){
    console.log(1)
}
let obj= {
    //window.obj.setToken
    setToken(){
        console.log(2)
    },
    created(){
        //在函数当中
        //全局
        if(true){
            /*
            let setToken = function(){
                console.log(3)
            }
            */
            var setToken = function(){
                console.log(3)
            }
        }
        setToken()
    }
}
obj.created()
//变量和方法存在于作用域
//作用域的分类
//(1)全局-window
//(2)局部-方法/函数
//(3)快级作用域
//针对let,const
//if(){}
//for(){}
//作用域链
//变量查找顺序,从里到外,一个个作用域找东西

</script>
</html>
